using System;
using NHibernate.Event;
using Caramel.NHibernate.Entities;

namespace Caramel.NHibernate.Configuration
{
	public static class ConfigurationExtensions
	{
		public static global::NHibernate.Cfg.Configuration AddPreInsertEntityEventListener(this global::NHibernate.Cfg.Configuration config)
		{
			config.EventListeners.PreInsertEventListeners = new IPreInsertEventListener[] { new PreInsertEntityEventListener() };

			return config;
		}

		public static global::NHibernate.Cfg.Configuration AddPreUpdateEventListener(this global::NHibernate.Cfg.Configuration config)
		{
			config.EventListeners.PreUpdateEventListeners = new IPreUpdateEventListener[] { new PreUpdateEntityEventListener() };

			return config;
		}
	}
}
